<!--
 * @Author: 叫我龟先生 yyxxkahhh@163.com
 * @Date: 2022-09-24 12:02:46
 * @LastEditors: 叫我龟先生 yyxxkahhh@163.com
 * @LastEditTime: 2022-09-25 11:12:57
 * @FilePath: \shopcar\src\components\MyGoods.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="my-goods-item">
    <div class="left">
      <div class="custom-control custom-checkbox">
        <!-- 2.6v-model做双向绑定 -->
        <!-- 2.7 每个元素的id做表单的id-->
        <input type="checkbox" 
        v-model="good.goods_state"
        class="custom-control-input" 
        :id="good.id"
        >
        
        <label class="custom-control-label" for="input">
          <!-- 2.6渲染商品信息 -->
          <img :src="good.goods_img" alt="">
        </label>
      </div>
    </div>
    <div class="right">
      
      <div class="top">{{good.goods_name}}</div>
      <div class="bottom">
        <span class="price">¥ {{good.goods_price}}</span>
        <span>
            数量组件
        </span>
        <!-- 3.3 -->
        <MyCount :good='good'></MyCount>
      </div>
    </div>
    
  </div>
</template>

<script>
  //3.1引入mycount组件并使用‘
  import MyCount from './MyCount.vue'
export default {

  //2.5Object定义good类型是对象
props:{
  good:Object
},
//3.2
components:{
  MyCount
}
}
</script>

<style lang="less" scoped>
.my-goods-item {
  display: flex;
  padding: 10px;
  border-bottom: 1px solid #ccc;
  .left {
    img {
      width: 120px;
      height: 120px;
      margin-right: 8px;
      border-radius: 10px;
    }
    .custom-control-label::before,
    .custom-control-label::after {
      top: 50px;
    }
  }
  .right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .top{
        font-size: 14px;
        font-weight: 700;
    }
    .bottom {
      display: flex;
      justify-content: space-between;
      padding: 5px 0;
      align-items: center;
      .price {
        color: red;
        font-weight: bold;
      }
    }
  }
}

</style>